﻿using Sgr.Domain.Repositories;
using System.Threading.Tasks;
using System.Threading;

namespace Sgr.UPMS.Domain.Duties
{
    /// <summary>
    ///
    /// </summary>
    public interface IDutyRepository : IBaseRepositoryOfTEntityAndTPrimaryKey<Duty, long>
    {
        /// <summary>
        /// 判断职务编码是否唯一
        /// </summary>
        /// <param name="code">职务编码</param>
        /// <param name="exclude_dutyId">需要排除的职务ID（用于编辑场景）</param>
        /// <param name="orgId">组织ID</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns>true: 编码唯一; false: 编码已存在</returns>
        Task<bool> CodeIsUniqueAsync(string code, long? exclude_dutyId = null, long orgId = 0, CancellationToken cancellationToken = default);

        /// <summary>
        /// 判断职务名称是否唯一
        /// </summary>
        /// <param name="name">职务名称</param>
        /// <param name="exclude_dutyId">需要排除的职务ID（用于编辑场景）</param>
        /// <param name="orgId">组织ID</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns>true: 名称唯一; false: 名称已存在</returns>
        Task<bool> NameIsUniqueAsync(string name, long? exclude_dutyId = null, long orgId = 0, CancellationToken cancellationToken = default);
    }
}